package org.bitterorange.flansmodslain.listeners;

import com.flansmod.common.eventhandlers.BFMCKeyInputEvent;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import org.bitterorange.flansmodslain.models.BFMCBukkitKeyInputEvent;
import org.bitterorange.flansmodslain.models.EnumBFMCKeyType;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

public class BFMCKeyInputListener {

    @Mod.EventHandler
    @SubscribeEvent
    public void onKeyInput(BFMCKeyInputEvent event) {
        Player player = Bukkit.getPlayer(event.getPlayerName());
        if (player != null) {
            switch (event.getKeyType()) {
                case menu:
                    Bukkit.getServer().getPluginManager().callEvent(new BFMCBukkitKeyInputEvent(EnumBFMCKeyType.menu, player));
                    break;
                case f10:
                    Bukkit.getServer().getPluginManager().callEvent(new BFMCBukkitKeyInputEvent(EnumBFMCKeyType.f10, player));
                    break;
                case taunt:
                    Bukkit.getServer().getPluginManager().callEvent(new BFMCBukkitKeyInputEvent(EnumBFMCKeyType.taunt, player));
                    break;
            }
        }
    }
}
